package com.itheima.service.db.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.domain.UmsAdminRoleRelation;
import com.itheima.mapper.UmsAdminRoleRelationMapper;
import com.itheima.service.db.UmsAdminRoleRelationService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class UmsAdminRoleRelationServiceImpl implements UmsAdminRoleRelationService {

    @Autowired
    UmsAdminRoleRelationMapper umsAdminRoleRelationMapper;

    //根据adminId查询roleId
    @Override
    public Long findByAdminId(Long adminId) {
        LambdaQueryWrapper<UmsAdminRoleRelation> qw = new LambdaQueryWrapper<>();
        qw.eq(UmsAdminRoleRelation::getAdminId,adminId);
        UmsAdminRoleRelation umsAdminRoleRelation = umsAdminRoleRelationMapper.selectOne(qw);
        return umsAdminRoleRelation.getRoleId();
    }

}
